@extends('hrs.layouts.app')  
@section('css')
        <!-- Custombox css -->
        <link href="{{asset('hrs/plugins/select2/css/select2.css')}}" rel="stylesheet">
        <link href="{{asset('hrs/plugins/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css')}}" rel="stylesheet">
@endsection 
@include('vendor.ueditor.assets')       
@section('content')

            <div class="container">

                

                <div class="row">
                    <div class="col-sm-12">
                    

                    @if(session::has('rs')|| $errors->any())
                    <div class="alert alert-danger">
                                        <i class="md  md-highlight-remove"></i> 
                    @if($errors->any())
                        @foreach($errors->messages() as $msg )
                            {{$msg[0]}}
                        @endforeach
                    @endif
                                        {{session('rs')['msg']}}
                    </div>
                    
                    @endif

                        <form method="post" action="{{url('user/task/update')}}" enctype="multipart/form-data">
                            {{ csrf_field()}}
                            <input type="hidden" name="id" value="{{$data->id}}" />

                            <div class="row">
                                <div class="col-lg-8">
                                    <div class="card-box">
                                        <h5 class="text-muted text-uppercase m-t-0 m-b-20"><b>修改任务</b></h5>

                                        <div class="form-group m-b-20">
                                            <label>任务名称 <span class="text-danger">*</span></label>
                                            <input type="text" class="form-control" name="name" placeholder="" value="{{$data->name}}">
                                        </div>

                                        <div class="form-group m-b-20">
                                            <label>宝贝链接 <span class="text-danger">*</span></label>
                                            <textarea class="form-control" name="task_url">{{$data->task_url}}</textarea> 
                                        </div>
                                        <div class="form-group m-b-20">
                                            <label>电商平台 <span class="text-danger">*</span></label>
                                            <select class="form-control select2" name="platform_id">
                                                <option value="">请选择</option>
                                            @foreach($platforms as $p)   
                                                <option value="{{$p->id}}" {{$data->platform_id == $p->id?'selected':''}}>{{$p->name}}</option>
                                            @endforeach    
                                                

                                            </select>

                                        </div>

                                        <div class="form-group m-b-20">
                                            <label>结束时间 <span class="text-danger">*</span></label>
                                            <input type="text" class="form-control" name="endtime" placeholder="" value="{{$data->endtime}}" id="endtime">
                                        </div>

                                        
            <div class="form-group m-b-20">
                <img src="{{$data->thumb}}" width="200">
                <label class="control-label">任务图片</label>
                                                <input type="file" class="filestyle" data-buttontext="选择图片" data-buttonname="btn-white" name="thumb" >
            </div>
                                        



                                     <div class="form-group m-b-20">
                                            <label>任务描述<span class="text-danger">*</span></label>
                                            
                                            <!-- 实例化编辑器 -->
<script type="text/javascript">
    var ue = UE.getEditor('describe');
    ue.ready(function() {
        ue.execCommand('serverparam', '_token', '{{ csrf_token() }}'); // 设置 CSRF token.
    });
</script>

<!-- 编辑器容器 -->
<script id="describe" name="describe" type="text/plain">{!!$data->describe!!}</script>
                                        </div>   

                                        

                                    </div>
                                </div>


                                <div class="col-lg-4">
                                    <div class="card-box">
                                        <h5 class="text-muted text-uppercase m-t-0 m-b-20"><b>费用信息</b></h5>

                                        <div class="form-group m-b-20">
                                            <label>宝贝价格</label>
                                            <input type="text" class="form-control" required="" name="price" value="{{$data->price}}">
                                        </div>

                                         <div class="form-group m-b-20">
                                            <label>任务数量</label>
                                            <input type="number" class="form-control" required="" name="num" value="{{$data->num}}">
                                        </div>

                                        <div class="form-group m-b-20">
                                            <label>佣金</label>
                                            <input type="text" class="form-control" required="" name="commission" value="{{$data->commission}}">
                                        </div>


                                <div class="form-group">
                                  
                                    <div class="text-center p-20">
                                         
                                         <button type="submit" class="btn w-sm btn-default waves-effect waves-light">更新</button>
                                         
                                    </div>
                                </div>
                           

                                        

                                    </div>

                                </div>


                            </div>


                            
                        
                        </form>
                    </div>
                </div>

               

            </div> <!-- end container -->
@endsection        

        
@section('js')
  

<script src="{{asset('hrs/plugins/bootstrap-filestyle/js/bootstrap-filestyle.min.js')}}" type="text/javascript"></script>
<script type="text/javascript" src="{{asset('hrs/plugins/select2/js/select2.min.js')}}"></script>
<script type="text/javascript" src="{{asset('hrs/plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js')}}"></script>
<script type="text/javascript" src="{{asset('hrs/plugins/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js')}}" charset="UTF-8"></script>
<script type="text/javascript">
    $('.select2').select2();

    $('#endtime').datetimepicker({
        format: "yyyy-mm-dd hh:ii:ss",
        autoclose: true,
        todayBtn: true,
        startDate: new Date()
       
    });

</script>        
@endsection

